package com.daedalus.Gui.Email;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


public class MailSendLayout extends JPanel implements ActionListener{
    JLabel adresaLabel, subjektiLabel;
    JTextField adresa, subjekti;
    JTextArea area;
    JButton sendButton, anulloButton;

	public MailSendLayout(){

		setSize(500,600);
		setLayout(new BorderLayout(30,30));
		
		adresaLabel =new JLabel("Tek");
		subjektiLabel =new JLabel("Subjekti");
		adresa=new JTextField();
		subjekti= new JTextField();
		area=new JTextArea();
		JScrollPane pane=new JScrollPane(area);
		
		JPanel northPanel=new JPanel(new GridLayout(2,2,5,5));
		northPanel.add(adresaLabel);
        northPanel.add(adresa);

        northPanel.add(subjektiLabel);
		northPanel.add(subjekti);

        add(northPanel, BorderLayout.NORTH);
		
		pane.setVerticalScrollBarPolicy( ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
		add(pane, BorderLayout.CENTER);

        JPanel southPanel= new JPanel(new GridLayout(1,2,20,60));

        sendButton=new JButton("Dergo !");
        anulloButton=new JButton("Anullo");

        southPanel.add(sendButton);
        southPanel.add(anulloButton);

        add(southPanel,BorderLayout.SOUTH);

        sendButton.addActionListener(this);
        anulloButton.addActionListener(this);
		
	}


    public static void main(String[] args){
        JFrame frame = new JFrame();
        frame.setTitle("Shkruaj E-Mail");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(500, 600);

        frame.add(new MailSendLayout());
        frame.setVisible(true);

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource()==anulloButton){
            JOptionPane.showMessageDialog(this, "Dergimi u Anullua", "Cancel", JOptionPane.WARNING_MESSAGE);
            System.exit(1);
        }
        if (e.getSource()==sendButton){
            JOptionPane.showMessageDialog(this, "Mesazhi u dergua", "Sent", JOptionPane.INFORMATION_MESSAGE);
        }
    }
}
